package com.example.cloud.controller.business.reservation;

import com.example.cloud.controller.common.BaseController;
import com.example.cloud.model.dto.QueryModel;
import com.example.cloud.model.dto.Result;
import com.example.cloud.model.statistics.ScoreRecord;
import com.example.cloud.service.business.reservation.ScoreRecordService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Created by wangtao on 2018/1/26.
 */
@RestController
@RequestMapping("/score")
public class ScoreRecordController extends BaseController {

    private Logger logger = LoggerFactory.getLogger(ScoreRecordController.class);

    @Autowired
    private ScoreRecordService scoreRecordService;

    @PostMapping("/search")
    public Result search(@RequestBody QueryModel model) {
        return this.singleQuery(model, ScoreRecord.class);
    }

    @PostMapping("/saveOrUpdate")
    public void saveOrUpdate(@RequestBody ScoreRecord record) {
        scoreRecordService.doSave(record);
    }

    @PostMapping("/delete")
    public void delete(@RequestBody List<Long> ids){
        scoreRecordService.doDelete(ids);
    }

}
